<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
          "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>QUnit sign() and verify() test of 'jws.js'</title>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />

<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="qunit.js"></script>

<script language="JavaScript" type="text/javascript" src="../jsrsasign-jwths-min.js"></script>

<script type="text/javascript">
function RSAKey() {}

$(document).ready(function(){

// tool_jwt.html with two aud
var jwtHS256AUD2 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2p3dC1pZHAuZXhhbXBsZS5jb20iLCJzdWIiOiJtYWlsdG86bWlrZUBleGFtcGxlLmNvbSIsIm5iZiI6MSwiZXhwIjoyMDgyNzU4Mzk5LCJpYXQiOjE0MzI5MTQyODMsImp0aSI6ImlkMTIzNDU2IiwidHlwIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9yZWdpc3RlciIsImF1ZCI6WyJodHRwOi8vZm9vMS5jb20iLCJodHRwOi8vZm9vMi5jb20iXX0.brHoaBSFRnGH3VspSgTW1H2VFNS1Ju_pWU4aomrjjq8";

test("verifyJWT alg ", function() {
  equal(KJUR.jws.JWS.verifyJWT(jwtHS256AUD2, "616161", {alg: ["HS256"]}),
        true, "verifyJWT HS256 in [HS256]");
});

test("sign HS256", function() {
  equal(KJUR.jws.JWS.sign(null, {"alg":"HS256", "cty":"JWT"}, {"age": 21}, "aaa"), 'eyJhbGciOiJIUzI1NiIsImN0eSI6IkpXVCJ9.eyJhZ2UiOjIxfQ.pLem30ReEpeXgMt6e3gjZ6QYSpLBbhd_NB-Afud1m4A', 'sign');
});

});
</script>
  
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
<p>
<a href="../">TOP</a> | 
<a href="index.html">TEST INDEX</a> | 
<a href="qunit-do-jws-sign.html">asynmetric key(RS/PS/ES) sign/verify</a> | 
<a href="qunit-do-jws-sign-hs.html">Hmac(HS) sign/verify</a> | 
<a href="qunit-do-jws-sign-slow.html">sign/verify slow</a> | 
<a href="qunit-do-jws-intdate.html">IntDate</a> | 
</p>
</body>
</html>

